

// Data Wide
use "$dir\data\cleaned\estimation_data.dta", clear

	rename czone cat_czone

	keep czone_sh_manufac czone_sh_services czone_sh_college czone_sh_foreign czone_sh_fem_emp czone_pop czone_lf ///
	contemp_mean_oas_std  inst_mean_ind_std_2000 inst_mean_ind_std_1970 cat_czone year state epop100 ///
	lwg_wage_pop_r *_pop_pct  *_college_pct  *lwg_annual_r  *_lwg_yr_col_r *_lwg_yr_nocol_r  *share flfp mlfp oas_nc_wage_gap oas_col_wage_gap
	
	
	rename *collar* *c*
	rename *white* *wh*
	rename *_cz_* *_*
	
	
	global reshape czone_sh_manufac czone_sh_services czone_sh_college czone_sh_foreign czone_sh_fem_emp czone_pop czone_lf ///
	contemp_mean_oas_std  inst_mean_ind_std_2000 inst_mean_ind_std_1970 state epop100 ///
	 lwg_wage_pop_r *_pop_pct  *_college_pct  *lwg_annual_r  *_lwg_yr_col_r *_lwg_yr_nocol_r  *share flfp mlfp oas_nc_wage_gap oas_col_wage_gap
	
	keep $reshape cat_czone year
	reshape wide $reshape , i(cat_czone) j(year)
 
// Create Changes 

	global vars1 czone_sh_manufac czone_sh_services czone_sh_college czone_sh_foreign czone_sh_fem_emp czone_pop czone_lf ///
	contemp_mean_oas_std  inst_mean_ind_std_2000 inst_mean_ind_std_1970 state epop100 lwg_annual_r lwg_wage_pop_r flfp mlfp oas_nc_wage_gap oas_col_wage_gap
	
	foreach var in $vars1 {
		gen ch_lng_`var' = `var'2016 - `var'2007
		label var ch_lng_`var' "Change of `var' 2016-2007"
		gen ch_sht_`var'1 = `var'2012 - `var'2007
		label var ch_sht_`var'1 "Change of `var' 2012-2007"
		gen ch_sht_`var'2 = `var'2016 - `var'2012
		label var ch_sht_`var'2 "Change of `var' 2016-2012"
	}
	
global occupations oas non_oas blue_c pink_c wh_m_c wh_f_c wh_c


foreach var in _pop_pct  _college_pct  _lwg_annual_r  _lwg_yr_col_r _lwg_yr_nocol_r  _share {
foreach occ of global occupations  {
display "`occ'`var'"
gen ch_lng_`occ'`var' = `occ'`var'2016 - `occ'`var'2007
		label var ch_lng_`occ'`var' "Change of `occ'`var' 2016-2007"
		gen ch_sht_`occ'`var'1 = `occ'`var'2012 - `occ'`var'2007
		label var ch_sht_`occ'`var'1 "Change of `occ'`var' 2012-2007"
		gen ch_sht_`occ'`var'2 = `occ'`var'2016 - `occ'`var'2012
		label var ch_sht_`occ'`var'2 "Change of `occ'`var' 2016-2012"
	}
	
	}


save "$dir\data\cleaned\estimation_data_wide.dta", replace



	
	



